package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Zproductbrand {
    private int pdId;
    private String pbName;
    private Collection<Zproduct> zproductsByPdId;
    private Collection<Zproductcategory> zproductcategoriesByPdId;

    @Id
    @Column(name = "pd_id")
    public int getPdId() {
        return pdId;
    }

    public void setPdId(int pdId) {
        this.pdId = pdId;
    }

    @Basic
    @Column(name = "pb_name")
    public String getPbName() {
        return pbName;
    }

    public void setPbName(String pbName) {
        this.pbName = pbName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Zproductbrand that = (Zproductbrand) o;
        return pdId == that.pdId &&
                Objects.equals(pbName, that.pbName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pdId, pbName);
    }

    @OneToMany(mappedBy = "zproductbrandByPdId")
    public Collection<Zproduct> getZproductsByPdId() {
        return zproductsByPdId;
    }

    public void setZproductsByPdId(Collection<Zproduct> zproductsByPdId) {
        this.zproductsByPdId = zproductsByPdId;
    }

    @OneToMany(mappedBy = "zproductbrandByPdId")
    public Collection<Zproductcategory> getZproductcategoriesByPdId() {
        return zproductcategoriesByPdId;
    }

    public void setZproductcategoriesByPdId(Collection<Zproductcategory> zproductcategoriesByPdId) {
        this.zproductcategoriesByPdId = zproductcategoriesByPdId;
    }
}
